using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ParamCube : MonoBehaviour
{

    public int band;
    public float startScale, scaleMultiplier;

    Material material;
    private void Awake()
    {
        band = transform.GetSiblingIndex();
    }
    void Start()
    {
        material = GetComponent<MeshRenderer>().materials[0];
    }

    // Update is called once per frame
    void Update()
    {
        if (AudioVisable.isSamplesOver == true)
        {
            float y = (AudioVisable._audioBandBuffer[band]) * scaleMultiplier + startScale;

            transform.localScale = new Vector3(transform.localScale.x,y , transform.localScale.z);
            Color color = new Color(AudioVisable._audioBandBuffer[band], AudioVisable._audioBandBuffer[band], AudioVisable._audioBandBuffer[band]);
            material.SetColor("_EmissionColor", color);
        }
      
    }
}

